package org.example.eight3.service.impl;

import org.example.eight3.dao.UserDao;
import org.example.eight3.dao.impl.UserDaoImpl;
import org.example.eight3.model.User;
import org.example.eight3.service.UserService;
import org.example.eight3.util.BCryptUtil;

public class UserServiceImpl implements UserService {
    @Override
    public User userLogin(String username, String password) {

        UserDaoImpl userDao = new UserDaoImpl();
        User userLogin = userDao.findByUserName(username);
        boolean verify = BCryptUtil.varify(password, userLogin.getPassword());
        if (verify){
            return userLogin;
        }else {
            return null;
        }

    }
}

